package tau_sadna.tau_map;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;

public class ResultButtonListener implements OnClickListener {

	private Result result;
	private MainActivity mainActivity;

	public ResultButtonListener(MainActivity act, Result r) {
		result = r;
		mainActivity = act;
	}

	@Override
	public void onClick(View v) {
		Log.i("ResultButtonListener","Showing result "+result.getName().getName());
		InputMethodManager imm = (InputMethodManager)mainActivity.getSystemService(
			      Context.INPUT_METHOD_SERVICE);
		imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
		mainActivity.showResult(result);
		mainActivity.closeCurrentWindow();
	}

}
